package com.tuniondata.netty.bean;

import java.util.HashMap;
import java.util.Map;

/**
 * @author yuxinchao
 */
public final class ResponseCodeConstant {
    public static final Map<String, String> codes = new HashMap<>();

    static {
        codes.put("00", "成功");
        codes.put("02", "无效的消息类型码");
        codes.put("03", "无效的消息版本");
        codes.put("04", "无效的报文长度");
        codes.put("05", "MAC错");
        codes.put("06", "文件摘要验证失败");
        codes.put("07", "文件名不合法");
        codes.put("08", "文件大小或内容不合法");
        codes.put("09", "无效文件断点");
        codes.put("50", "系统错误");
    }

    public static String getMessage(String code) {
        return codes.get(code);
    }

    public static String getMessage(String code, String defaultMessage) {
        return codes.getOrDefault(code, defaultMessage);
    }
}
